<?php 
namespace Home\Model;
use Think\Model;
class CategoryModel extends Model {
	public function getCate()
	{
		$cate = $this->select();

		$tempArr = [];

		foreach ($cate as  $row) {
			if($row['fid']==0){
				$tempArr[]=$row;
			}
		}

		foreach ($tempArr as $k => $father) {
			foreach ($cate as  $v) {
				if($v['fid']==$father['id']){
					$tempArr[$k]['son'][]= $v;
				}
			}
		}

		return $tempArr;
	}
}